package com.risen.project.enums;

import lombok.Getter;

import java.util.Arrays;
import java.util.Optional;

/**
 * 项目类型枚举
 */
@Getter
public enum ProjectTypeEnum {

    PTE_JS("1", "建设"),

    PTE_YW("2", "运维")
    ;

    private final String code;
    private final String msg;

    ProjectTypeEnum(String code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public static String getMsgByCode(String code) {
        Optional<ProjectTypeEnum> optional = Arrays.stream(values())
                .filter(c -> c.code.equals(code))
                .findFirst();

        return optional.isPresent() ? optional.get().msg : "";
    }
}
